package cn.edu.njnu.opengmpback.collaboration.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 任务依赖关系图实体类
 * 用于存储项目中任务间的依赖关系
 */
@Data
@Document(collection = "TaskDependencyGraph")
public class TaskDependencyGraph {
    @Id
    private String id;                    // 图ID，使用项目aid
    private String projectId;             // 项目ID（aid）
    private Map<String, List<String>> dependencies;  // 任务依赖关系Map
    private Date createdTime;             // 创建时间
    private Date updatedTime;             // 更新时间
    private String creatorId;             // 创建者ID

    // 构造函数
    public TaskDependencyGraph() {}

    public TaskDependencyGraph(String projectId, Map<String, List<String>> dependencies, String creatorId) {
        this.projectId = projectId;
        this.dependencies = dependencies;
        this.creatorId = creatorId;
        this.createdTime = new Date();
        this.updatedTime = new Date();
    }
}